package com.bkhech.satoken.service;

import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.util.SaResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 注解鉴权-基于 aop 才起作用
 *
 * <-- Sa-Token 整合 SpringAOP 实现注解鉴权 -->
 * <dependency>
 *     <groupId>cn.dev33</groupId>
 *     <artifactId>sa-token-spring-aop</artifactId>
 *     <version>1.34.0</version>
 * </dependency>
 *
 * @author guowm
 * @date 2023/8/3
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class AnnotationCheckService {

    // 角色校验：必须具有指定角色才能进入该方法
    @SaCheckRole("super-admin")
    public SaResult add() {
        return SaResult.ok("用户增加");
    }


}
